#include "catch2/catch.hpp"

int factorial(int n)
{
    return (n <= 1) ? 1 : n * factorial(n - 1);
}

TEST_CASE("Factorial function", "[factorial]")
{
    REQUIRE(factorial(0) == 1);
    REQUIRE(factorial(1) == 1);
    REQUIRE(factorial(2) == 2);
    REQUIRE(factorial(3) == 6);
    REQUIRE(factorial(10) == 3628800);
}

TEST_CASE("Factorial of numbers", "[factorial]")
{
    SECTION("Testing zero")
    {
        REQUIRE(factorial(0) == 1);
    }
    SECTION("Testing small numbers")
    {
        REQUIRE(factorial(3) == 6);
        REQUIRE(factorial(2) == 2);
    }
}

TEMPLATE_TEST_CASE("Factorial of numbers", "[factorial][template]", int, long)
{
    REQUIRE(factorial(TestType(0)) == 1);
    REQUIRE(factorial(TestType(1)) == 1);
    REQUIRE(factorial(TestType(2)) == 2);
}
